// 二次封装axios
import request from "../../utils/request";
import type {
    HospitalDetail, DepartmentResponseData, loginData, UserLoginResponseData,
    WXLoginResponseData, HospitalWorkResponseData, DoctorResponseData, UserResponseData,DoctorInfoData
} from "./type"
//通过枚举管理首页模块的接口地址
enum API {
    //获取已有的医院数据接口地址
    HOSPITAL_DETAIL_URL = '/hosp/hospital/',
    // 获取医院科室数据接口地址
    HOSPITAL_DEPARTMENT_URL = '/hosp/hospital/department/',
    // 获取验证码接口
    GETUSERCODE_URL = '/sms/send/',
    // 用户登录接口
    USERLOGIN_URL = '/user/login',
    // 获取微信扫码登录需要的参数
    WXLOGIN_URL = '/user/weixin/getLoginParam/',
    // 获取某一个医院的某一个科室预约挂号数据
    HOSPITALWORK_URL = '/hosp/hospital/auth/getBookingScheduleRule/',
    // 获取科室排班信息(票号信息)
    HOSPITALDOCTOR_URL = '/hosp/hospital/auth/findScheduleList/',
    // 获取某一账号下就诊人信息
    GRTVISITO_URL = '/user/patient/auth/findAll',
    // 获取挂号医生信息
    GETDOCTOR_URL = '/hosp/hospital/getSchedule/'
}
// 获取医院详情数据
export const reqHospitalDetail = (hoscode: string) =>
    request.get<any, HospitalDetail>(API.HOSPITAL_DETAIL_URL + hoscode);
// 获取医院科室列表数据
export const reqHospitalDepament = (hoscode: string) =>
    request.get<any, DepartmentResponseData>(API.HOSPITAL_DEPARTMENT_URL + hoscode);
// 获取验证码数据
export const reqCode = (phone: string) => request.get<any, any>(API.GETUSERCODE_URL + phone);
// 用户登录数据
export const reqUserlogin = (data: loginData) => request.post<any, UserLoginResponseData>(API.USERLOGIN_URL, data);
// 获取微信扫码登录声称二维码需要参数接口
export const reqWxLogin = (wxRedirectUri: string) =>
    request.get<any, WXLoginResponseData>(API.WXLOGIN_URL + `?wxRedirectUri=${wxRedirectUri}`)
// 获取预约挂号的数据
export const reqHospitalWork = (page: number, limit: number, hoscode: string, depcode: string) =>
    request.get<any, HospitalWorkResponseData>(API.HOSPITALWORK_URL + `${page}/${limit}/${hoscode}/${depcode}`);
// 获取医生排班数据
export const reqHospitalDoctor = (hoscode: string, depcode: string, workDate: string) =>
    request.get<any, DoctorResponseData>(API.HOSPITALDOCTOR_URL + `${hoscode}/${depcode}/${workDate}`);
// 获取某一账号就诊人信息
export const reqGetVisito = () => request.get<any, UserResponseData>(API.GRTVISITO_URL);
// 获取挂号医生信息
export const reqDoctorInfo = (scheduleId:string)=>request.get<any,DoctorInfoData>(API.GETDOCTOR_URL+scheduleId);